home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutor.exe
/
SOURCE
/
INTASIGN.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-15
|
927b
|
32 lines
/* Chapter 4 - Program 1 - INTASIGN.C */
/* This program will illustrate the assignment statements */
void main()
{
int a, b, c; /* Integer variables for examples */
a = 12;
b = 3;
c = a + b; /* simple addition */
c = a - b; /* simple subtraction */
c = a * b; /* simple multiplication */
c = a / b; /* simple division */
c = a % b; /* simple modulo (remainder) */
c = 12*a + b/2 - a*b*2/(a*c + b*2);
c = c/4+13*(a + b)/3 - a*b + 2*a*a;
a = a + 1; /* incrementing a variable */
b = b * 5;
a = b = c = 20; /* multiple assignment */
a = b = c = a + b * c/ 3;
a = (b = (c = 20)); /* Identical to line 20 */
}
/* Result of execution
(No output from this program.)
*/